package com.javasm.mb_store_api_final.giftsandgoods.gift.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.javasm.mb_store_api_final.giftsandgoods.gift.dao.GmGiftDao;
import com.javasm.mb_store_api_final.giftsandgoods.gift.entity.GmGift;
import com.javasm.mb_store_api_final.giftsandgoods.gift.service.GmGiftService;
import com.javasm.mb_store_api_final.giftsandgoods.gift.vo.GiftQueryVo;
import com.javasm.mb_store_api_final.giftsandgoods.gift.vo.GiftVo;
import com.javasm.mb_store_api_final.giftsandgoods.goods.entity.GgGoods;
import com.javasm.mb_store_api_final.giftsandgoods.goods.service.GgGoodsService;
import com.javasm.mb_store_api_final.giftsandgoods.goodsType.entity.GgGoodsType;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * (GmGift)表服务实现类
 *
 * @author makejava
 * @since 2024-07-29 19:17:55
 */
@Service("gmGiftService")
public class GmGiftServiceImpl extends ServiceImpl<GmGiftDao, GmGift> implements GmGiftService {

    @Resource
    GmGiftDao gmGiftDao;

    @Override
    public List<GiftVo> listGifts() {
        List<GiftVo> giftVos =  gmGiftDao.listGifts();
        return giftVos;
    }

    @Override
    public Map<String, List<String>> paramList() {
        List<String> gcolors =gmGiftDao.listgcolor();
        List<String> gtypes =gmGiftDao.listgtype();
        List<String> gbrands =gmGiftDao.listgbrand();

        Map<String, List<String>> map = Map.of("gcolors",gcolors,"gtypes",gtypes,"gbrands",gbrands);
        return map;
    }

    @Override
    public List<GiftVo> ListByParams(GiftQueryVo giftQueryVo) {
        List<GiftVo> giftVos = gmGiftDao.ListByParams(giftQueryVo);
        return giftVos;
    }

    @Override
    public GgGoods listDetail(Integer id) {
        GgGoods ggGoods = gmGiftDao.listDetail(id);
        return ggGoods;
    }

    @Override
    public Integer updateGift(GiftVo giftVo) {
       Integer i1= gmGiftDao.updateGift(giftVo);
       Integer i2=  gmGiftDao.updateGoodsById(giftVo);
       return i1+i2;
    }




}

